from django.http import HttpResponse
def simple(get_response):
    def middle(request):
        #这里是请求前
        user= request.COOKIES.get('username')
        if user is None:
            print('username is none')
            return HttpResponse('没有登录')
        print('before')
        respon = get_response(request)

        print('after request')
        return respon
    return middle